package server.ui;

import javafx.animation.Animation;
import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.util.Duration;
public class OnlineUserApp extends Application {

    @Override
    public void start(Stage stage) throws Exception {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/server/ui/online_users.fxml"));
        Scene scene = new Scene(loader.load());
        OnlineUserController controller = loader.getController();

        Timeline timeline = new Timeline(
                new KeyFrame(Duration.seconds(5), e -> controller.refreshOnlineUsers())
        );
        timeline.setCycleCount(Animation.INDEFINITE);
        timeline.play();
        stage.setTitle("在线用户管理");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}